<template>
	<tm-app color="#efefef">		
			<view class="flex flex-between pl-30 FormM1">
				<navbar-module title="已喂食工单" :transprent="true"/>
			</view> 
			<tm-sheet :padding="[2,2]" style="margin-top:-200rpx">
				<view class="flex flex-start px-26 pt-20">
					<tm-icon name="tmicon-ios-filing" color="#23C343" class="mr-15" :font-size="32"/>
					<tm-text :label="itemData.code" :fontSize="32" class="text-weight-b"/>
				</view>

				<view class="px-26 py-20 flex flex-center flex-col">
					<tm-text label='查看猪猪喂食视频' :fontSize="32" class="py-16" @click="goto" color="blue"></tm-text>
				</view>
				
				<tm-cell bottomBorder :margin="[0,0]" title="猪仔数量" :titleFontSize="32">
					<template v-slot:right>
						<tm-text :fontSize="32">{{itemData.pigDetail?.length}} 头</tm-text>
					</template>
				</tm-cell>
				<tm-cell bottomBorder :margin="[0,0]" title="所属猪圈" :titleFontSize="32">
					<template v-slot:right>
						<tm-text :fontSize="32">{{itemData.pigsty?.name}}</tm-text>
					</template>
				</tm-cell>
				<tm-cell v-if="isManage" bottomBorder :margin="[0,0]" title="负责人" titleFontSize="32">
					<template v-slot:right>
						<tm-text :fontSize="32">{{itemData.staff.name}}</tm-text>
					</template>
				</tm-cell>
				<tm-cell bottomBorder :margin="[0,0]" title="主食" :titleFontSize="32">
					<template v-slot:right>
						<tm-text :fontSize="32">{{itemData.content?.combo?.name}}</tm-text>
					</template>
				</tm-cell>
				<tm-cell v-if="itemData.content?.affix?.length>0" bottomBorder :margin="[0,0]" title="零食:" :titleFontSize="32">
					<template v-slot:right></template>
				</tm-cell>
				<tm-cell v-for="(item,index) in itemData.content?.affix" :key="index" bottomBorder :margin="[0,0]" :title="item.name" :titleFontSize="32">
					<template v-slot:right>x{{item.amount}}</template>
				</tm-cell>
				
				<tm-cell bottomBorder :margin="[0,0]" title="入栏时间" :titleFontSize="32">
					<template v-slot:right>
						<tm-text :fontSize="32">{{itemData.completeTime}}</tm-text>
					</template>
				</tm-cell>
				
				
			</tm-sheet>
	</tm-app>
</template>

<script setup lang='ts'>
	import {onLoad} from '@dcloudio/uni-app'
    import { ref } from "vue";

	const itemData = ref({})
	const isManage = uni.getStorageSync('isManage')
	
	onLoad((option)=>{
		itemData.value = JSON.parse(decodeURIComponent(option.data))
	})
	
	const goto = () => {
		uni.navigateTo({
			url:`/pages/video/video?src=${itemData.value.video}`
		})
	}
	


</script>

<style>

</style>
